#ifndef STATEMANAGER_H
#define STATEMANAGER_H

#include "State.h"

enum ETransitionState
{
	Normal,
	Exit,
	Enter
};

class StateManager : public StateListener
{
public:
	typedef struct state_info {
		state_info() : m_state(nullptr) {}
		state_info(const String& id, State* state) : m_id(id), m_state(state){}
		String m_id;
		State* m_state;
	};

	StateManager(Systems* systems);
	~StateManager(void);

	bool Init();
	
	void Update(float deltatime);
	void Render();

	void ManageState(const String& id, State* state);
	State* FindById(const String& id);
	void ChangeState(State* state);
	bool PushState(State* state);
	void PopState();
	void Shut();

private:
	void ClearStates();
	std::vector<State*> m_stack;
	std::vector<state_info> m_states;
	State* m_next_state;
	Systems* m_systems;
	bool m_run;
};

#endif